package demo4;

import java.text.SimpleDateFormat;
import java.util.Date;

// 宿舍基础类
class Dormitory {
    // 宿舍编号
    private String dormitoryId;
    // 宿舍位置
    private String dormitoryLocation;
    // 宿舍设施
    private String dormitoryFacilities;
    // 宿舍容纳人数
    private int capacity;
    // 宿舍使用状态
    private boolean isOccupied;

    // 构造函数，用于初始化宿舍信息
    public Dormitory(String dormitoryId, String dormitoryLocation, String dormitoryFacilities, int capacity, boolean isOccupied) {
        this.dormitoryId = dormitoryId;
        this.dormitoryLocation = dormitoryLocation;
        this.dormitoryFacilities = dormitoryFacilities;
        this.capacity = capacity;
        this.isOccupied = isOccupied;
    }

    // 宿舍添加方法
    public void addDormitory() {
        // 这里可以实现将宿舍信息添加到数据库或其他存储介质的逻辑
        System.out.println("宿舍 " + dormitoryId + " 已添加。");
    }

    // 修改宿舍信息方法
    public void modifyDormitoryInfo(String dormitoryLocation, String dormitoryFacilities, int capacity) {
        this.dormitoryLocation = dormitoryLocation;
        this.dormitoryFacilities = dormitoryFacilities;
        this.capacity = capacity;
        System.out.println("宿舍 " + dormitoryId + " 信息已修改。");
    }

    // 更改宿舍状态方法
    public void changeDormitoryStatus(boolean isOccupied) {
        this.isOccupied = isOccupied;
        System.out.println("宿舍 " + dormitoryId + " 状态已更改。");
    }

    // 查询宿舍信息方法
    public void queryDormitoryInfo() {
        System.out.println("宿舍编号: " + dormitoryId);
        System.out.println("宿舍位置: " + dormitoryLocation);
        System.out.println("宿舍设施: " + dormitoryFacilities);
        System.out.println("宿舍容纳人数: " + capacity);
        System.out.println("宿舍使用状态: " + (isOccupied ? "已占用" : "未占用"));
    }
}